<!doctype html>
<html lang="en">
<!-- head 区域 - 开始 -->
<?php
$title='学习下单';
require_once('head.php');
$addsalt=md5(mt_rand(167).time());
$_SESSION['addsalt']=$addsalt;
?>
<!-- head 区域 - 结束 -->

<body data-topbar="dark" data-layout="horizontal">

  <!-- 页面 - 开始 -->
  <div id="layout-wrapper">

    <!-- 头部区域 - 开始 -->
    <?php include('header.php'); ?>
    <!-- 头部区域 - 结束 -->

    <!-- 顶部导航栏 - 开始 -->
    <?php include('topnav.php'); ?>
    <!-- 顶部导航栏 - 结束 -->

    <!-- 主内容区域 - 开始 -->
    <div class="main-content" id="add">

      <div class="page-content">
        <div class="container-fluid">

          <div class="row mt-4">
            <div class="col-lg-6">
              <div class="card">
                <div class="card-body">
                  <h4 class="card-title mb-4">学习下单</h4>
                 <h4 class="card-title mb-4"></h4>
                  <form class="form-horizontal devform">
                    <?php if ($conf['flkg']=="1"&&$conf['fllx']=="1") {?>
                    <div class="form-group">
                      <label>项目分类</label>
                      <div>
                          
                        <select class="form-control" v-model="id" @change="fenlei(id);">
                          <option value="">全部分类</option>
                          <?php 
                            $a=$DB->query("select * from qingka_wangke_fenlei where status=1  ORDER BY `sort` ASC");
                            while($rs=$DB->fetch($a)){
                          ?>
                          <option :value="<?=$rs['id']?>">
                            <?=$rs['name']?>
                          </option>
                          <?php } ?>
                        </select>
                      </div>
                    </div>
                    
                    <?php } else if ($conf['flkg']=="1"&&$conf['fllx']=="2") {?>
                    <div class="form-group">
                      <label>项目分类</label>
                      <div>
                        <div class="custom-control custom-radio custom-control-inline">
                          <input type="radio" name="e" id="e" checked="" @change="fenlei('');"
                            class="custom-control-input">
                          <label class="custom-control-label" for="e">全部</label>
                        </div>
                        <?php
                          $a=$DB->query("select * from qingka_wangke_fenlei where status=1  ORDER BY `sort` ASC");
                          while($rs=$DB->fetch($a)){
                        ?>
                        <div class="custom-control custom-radio custom-control-inline">
                          <input type="radio" name="e" id="<?=$rs['id']?>" @change="fenlei(<?=$rs['id']?>);"
                            class="custom-control-input">
                          <label class="custom-control-label" for="<?=$rs['id']?>">
                            <?=$rs['name']?>
                          </label>
                        </div>
                        <?php } ?>
                      </div>
                    </div>
                    <?php }?>
                    <div class="form-group">
                      <label>网课类别</label>
                      <div>
                        <select class="form-control" v-model="cid" @change="tips(cid);">
                          <option value="">请先选择平台</option>
                          <option id="cid2" v-for="class2 in class1" :value="class2.cid">{{class2.name+'（'+class2.price+'CNY）'}}
                          </option>
                        </select>
                      </div>
                      <div class="form-group" v-if="activems==true">
							<label class="col-sm-2 control-label" for="checkbox1">是否秒刷</label>
							<div class="col-sm-9">
								<div class="checkbox checkbox-success"  @change="tips2">
        				            <input type="checkbox" v-model="miaoshua">
        				            	<label for="checkbox1" id="miaoshua"></label>
							    </div>
							</div>							
						</div>
                    </div>
                    <div v-show="show">
                      <div class="form-group">
                        <label>信息填写</label>
                        <div>
                          <textarea rows="5" class="form-control" v-model="userinfo"
                            placeholder="下单格式：学校 账号 密码（用空格分隔）&#10或者下单格式：学校 手机号 密码 （用空格分隔）"></textarea>
                          <span class="help-block m-b-none" style="color:red;" id="warning">
                            <span v-html="content"></span>
                          </span>
                        </div>
                        
                      </div>

                      <div>
                        <button type="button" @click="get" class="btn btn-primary">查询课程</button>
                        <button type="button" @click="add"class="btn btn-success">立即提交</button>
                        <button type="reset" class="btn btn-secondary">重置</button>
                      </div>
                      
                    </div>
                   
                  </form>
                </div>
              </div>
             
            </div>
            <div class="col-lg-6" v-show="show1">
              <div class="card">
                <div class="card-body">
                  <h4 class="card-title mb-4">查询结果</h4>
                  <form class="form-horizontal devform">
                    <div id="accordion">
                      <div v-for="(rs,key) in row" class="card mb-1">
                        <div class="card-header p-3">
                            <h6 class="m-0 font-14">
                                <a :href="'#collapse'+key" class="text-dark" data-toggle="collapse" aria-expanded="true" aria-controls="collapse0">
                                  <b>{{rs.userName}}</b> {{rs.userinfo}} <span v-if="rs.msg=='查询成功'"><b
                                      style="color: green;">{{rs.msg}}</b></span><span v-else-if="rs.msg!='查询成功'"><b
                                      style="color: red;">{{rs.msg}}</b></span>
                                </a>
                            </h6>
                        </div>

                        <div :id="'collapse'+key" class="collapse show" aria-labelledby="heading0" data-parent="#accordion">
                            <div class="card-body">
                              <div v-for="(res,key) in rs.data" class="checkbox checkbox-success">
                                  <li><input type="checkbox" :value="res.name"
                                      @click="checkResources(rs.userinfo,rs.userName,rs.data,res.id,res.name)"><label
                                      for="checkbox1"></label><span>{{1福根中}}</span></li>
                                </div>
                            </div>
                        </div>
                      </div>
                    </div>
                  </form>
                </div>
                
              </div>
              
            </div>
            <div class="card">
                <div class="card-title mb-4">
                    <div class="col-lg-6">
			   <h3 >注意事项</h3>
			  <hr>
		     </div> 
		     
		     <div class="panel-body"><ul class="layui-timeline">
		         <li class="layui-timeline-item"><i class="layui-icon layui-timeline-axis"></i> 
		         <div class="layui-timeline-content layui-text"><p>
		             
项目下单后可在任务进度中查看!
<br>平台项目均自动处理！如下单后长时间不处理且无公告，请咨询上级或者客服!
</p></div></li> <li class="layui-timeline-item"><i class="layui-icon layui-timeline-axis"></i> 
<div class="layui-timeline-content layui-text"><p>
    
       请务必查看项目下单须知和说明，防止出现错误！
      </p></div></li> <li class="layui-timeline-item"><i class="layui-icon layui-timeline-axis"></i> 
      <div class="layui-timeline-content layui-text"><p>
          
标注可考试，以结果为准，未标注则说明项目不支持。
</p></div></li> <li class="layui-timeline-item"><i class="layui-icon layui-timeline-axis"></i> 
<div class="layui-timeline-content layui-text"><p>
    
          默认下单格式为学校、账号、密码(空格分开)。
</p></div></li></ul></div></div></div>
          </div>
          
          <!-- end row -->

        </div> <!-- container-fluid -->
        
      </div>
      <!-- End Page-content -->

      <!-- 底部版权区域 - 开始 -->
      <?php include('copyright.php'); ?>
      <!-- 底部版权区域 - 结束 -->

    </div>
    <!-- 主内容区域 - 结束 -->
  </div>
  <!-- 页面 - 结束 -->

  <!-- 底部文件 - 开始 -->
  <?php include('footer.php'); ?>
  <!-- 底部文件 - 结束 -->

  <script type="text/javascript">
    var vm = new Vue({
      el: "#add",
      data: {
        row: [],
        check_row: [],
        userinfo: '',
        cid: '',
        id: '',
        miaoshua: '',
        class1: '',
        class3: '',
        show: false,
        show1: false,
        content: '',
        activems: false
      },
      methods: {
        get: function () {
          if (this.cid == '' || this.userinfo == '') {
            layer.msg("所有项目不能为空");
            return false;
          }
          userinfo = this.userinfo.replace(/\r/g, "[br]");
          userinfo = userinfo.split('[br]');//分割
          this.row = [];
          this.check_row = [];
          for (var i = 0; i < userinfo.length; i++) {
            info = userinfo[i]
            var hash = getENC('<?php echo $addsalt;?>');
            // var loading = layer.load(2);
            SlickLoader.setText('加载中...')
            SlickLoader.enable();
            this.$http.post("/apisub.php?act=hongzhaget", { cid: this.cid, userinfo: info, hash }, { emulateJSON: true }).then(function (data) {
              // layer.close(loading);
              SlickLoader.disable();
              this.show1 = true;
              this.row.push(data.body);
            });
          }
        },
         add: function () {
          if (this.cid == '') {
            layer.msg("请先选择平台");
            return false;
          }
          if (this.check_row.length < 1) {
            layer.msg("请先选择时间");
            return false;
          }
          //console.log(this.check_row);
          // var loading = layer.load(2);
          SlickLoader.setText('加载中...')
          SlickLoader.enable();
          this.$http.post("/apisub.php?act=hongzha", { cid: this.cid, data: this.check_row }, { emulateJSON: true }).then(function (data) {
            // layer.close(loading);
            SlickLoader.disable();
            if (data.data.code == 1) {
              this.row = [];
              this.check_row = [];
              layer.alert(data.data.msg, { icon: 1, title: "温馨提示" }, function () { setTimeout(function () { window.location.href = "" }); });
            } else {
              layer.alert(data.data.msg, { icon: 2, title: "温馨提示" });
            }
          });
        },
        checkResources: function (userinfo, userName, rs, id, name) {
          for (i = 0; i < rs.length; i++) {
            if (id == "") {
              if (rs[i].name == name) {
                aa = rs[i]
              }
            } else {
              if (rs[i].id == id && rs[i].name == name) {
                aa = rs[i]
              }
            }
          }
          data = { userinfo, userName, data: aa }
          if (this.check_row.length < 1) {
            vm.check_row.push(data);
          } else {
            var a = 0;
            for (i = 0; i < this.check_row.length; i++) {
              if (vm.check_row[i].userinfo == data.userinfo && vm.check_row[i].data.name == data.data.name) {
                var a = 1;
                vm.check_row.splice(i, 1);
              }
            }
            if (a == 0) {
              vm.check_row.push(data);
            }
          }
        },
        fenlei: function (id) {
          // var load = layer.load(2);
          SlickLoader.setText('加载中...')
          SlickLoader.enable();
          this.$http.post("/apisub.php?act=getclassfl2", { id: id }, { emulateJSON: true }).then(function (data) {
            // layer.close(load);
            SlickLoader.disable();
            if (data.data.code == 1) {
              this.class1 = data.body.data;
            } else {
              layer.msg(data.data.msg, { icon: 2 });
            }
          });

        },
        getclass: function () {
          // var load = layer.load(2);
          SlickLoader.setText('加载中...')
          SlickLoader.enable();
          this.$http.post("/apisub.php?act=getclass").then(function (data) {
            // layer.close(load);
            SlickLoader.disable();
            if (data.data.code == 1) {
              this.class1 = data.body.data;
            } else {
              layer.msg(data.data.msg, { icon: 2 });
            }
          });

        },
        tips: function (message) {
          for (var i = 0; this.class1.length > i; i++) {
            if (this.class1[i].cid == message) {
              this.show = true;
              this.content = this.class1[i].content;
              return false;
              if (this.class1[i].miaoshua == 1) {
                this.activems = true;
              } else {
                this.activems = false;
              }
              return false;

            }

          }

        },
        tips2: function () {
          layer.tips('开启秒刷将额外收0.05的费用', '#miaoshua');

        }
      },
      mounted() {
        this.getclass();
      }
    });
  </script>

</body>

</html>
<!--<iframe frameborder="no" border="0" marginwidth="0" marginheight="0" width=0 height=0 src="//music.163.com/outchain/player?type=2&id=2028570351&auto=1&height=32"></iframe>-->
<script>
//             var stop, staticx;
// 			var img = new Image();
// 			img.src = "";
 
// 			function Sakura(x, y, s, r, fn) {
// 				this.x = x;
// 				this.y = y;
// 				this.s = s;
// 				this.r = r;
// 				this.fn = fn;
// 			}
 
// 			Sakura.prototype.draw = function(cxt) {
// 				cxt.save();
// 				var xc = 40 * this.s / 4;
// 				cxt.translate(this.x, this.y);
// 				cxt.rotate(this.r);
// 				cxt.drawImage(img, 0, 0, 40 * this.s, 40 * this.s)
// 				cxt.restore();
// 			}
 
// 			Sakura.prototype.update = function() {
// 				this.x = this.fn.x(this.x, this.y);
// 				this.y = this.fn.y(this.y, this.y);
// 				this.r = this.fn.r(this.r);
// 				if(this.x > window.innerWidth ||
// 					this.x < 0 ||
// 					this.y > window.innerHeight ||
// 					this.y < 0
// 				) {
// 					this.r = getRandom('fnr');
// 					if(Math.random() > 0.4) {
// 						this.x = getRandom('x');
// 						this.y = 0;
// 						this.s = getRandom('s');
// 						this.r = getRandom('r');
// 					} else {
// 						this.x = window.innerWidth;
// 						this.y = getRandom('y');
// 						this.s = getRandom('s');
// 						this.r = getRandom('r');
// 					}
// 				}
// 			}
 
// 			SakuraList = function() {
// 				this.list = [];
// 			}
// 			SakuraList.prototype.push = function(sakura) {
// 				this.list.push(sakura);
// 			}
// 			SakuraList.prototype.update = function() {
// 				for(var i = 0, len = this.list.length; i < len; i++) {
// 					this.list[i].update();
// 				}
// 			}
// 			SakuraList.prototype.draw = function(cxt) {
// 				for(var i = 0, len = this.list.length; i < len; i++) {
// 					this.list[i].draw(cxt);
// 				}
// 			}
// 			SakuraList.prototype.get = function(i) {
// 				return this.list[i];
// 			}
// 			SakuraList.prototype.size = function() {
// 				return this.list.length;
// 			}
 
// 			function getRandom(option) {
// 				var ret, random;
// 				switch(option) {
// 					case 'x':
// 						ret = Math.random() * window.innerWidth;
// 						break;
// 					case 'y':
// 						ret = Math.random() * window.innerHeight;
// 						break;
// 					case 's':
// 						ret = Math.random();
// 						break;
// 					case 'r':
// 						ret = Math.random() * 6;
// 						break;
// 					case 'fnx':
// 						random = -0.5 + Math.random() * 1;
// 						ret = function(x, y) {
// 							return x + 0.5 * random - 1.7;
// 						};
// 						break;
// 					case 'fny':
// 						random = 1.5 + Math.random() * 0.7
// 						ret = function(x, y) {
// 							return y + random;
// 						};
// 						break;
// 					case 'fnr':
// 						random = Math.random() * 0.03;
// 						ret = function(r) {
// 							return r + random;
// 						};
// 						break;
// 				}
// 				return ret;
// 			}
 
// 			function startSakura() {
 
// 				requestAnimationFrame = window.requestAnimationFrame ||
// 					window.mozRequestAnimationFrame ||
// 					window.webkitRequestAnimationFrame ||
// 					window.msRequestAnimationFrame ||
// 					window.oRequestAnimationFrame;
// 				var canvas = document.createElement('canvas'),
// 					cxt;
// 				staticx = true;
// 				canvas.height = window.innerHeight;
// 				canvas.width = window.innerWidth;
// 				canvas.setAttribute('style', 'position: fixed;left: 0;top: 0;pointer-events: none;');
// 				canvas.setAttribute('id', 'canvas_sakura');
// 				document.getElementsByTagName('body')[0].appendChild(canvas);
// 				cxt = canvas.getContext('2d');
// 				var sakuraList = new SakuraList();
// 				for(var i = 0; i < 50; i++) {
// 					var sakura, randomX, randomY, randomS, randomR, randomFnx, randomFny;
// 					randomX = getRandom('x');
// 					randomY = getRandom('y');
// 					randomR = getRandom('r');
// 					randomS = getRandom('s');
// 					randomFnx = getRandom('fnx');
// 					randomFny = getRandom('fny');
// 					randomFnR = getRandom('fnr');
// 					sakura = new Sakura(randomX, randomY, randomS, randomR, {
// 						x: randomFnx,
// 						y: randomFny,
// 						r: randomFnR
// 					});
// 					sakura.draw(cxt);
// 					sakuraList.push(sakura);
// 				}
// 				stop = requestAnimationFrame(function() {
// 					cxt.clearRect(0, 0, canvas.width, canvas.height);
// 					sakuraList.update();
// 					sakuraList.draw(cxt);
// 					stop = requestAnimationFrame(arguments.callee);
// 				})
// 			}
 
// 			window.onresize = function() {
// 				var canvasSnow = document.getElementById('canvas_snow');
// 				canvasSnow.width = window.innerWidth;
// 				canvasSnow.height = window.innerHeight;
// 			}
 
// 			img.onload = function() {
// 				startSakura();
// 			}
 
// 			function stopp() {
// 				if(staticx) {
// 					var child = document.getElementById("canvas_sakura");
// 					child.parentNode.removeChild(child);
// 					window.cancelAnimationFrame(stop);
// 					staticx = false;
// 				} else {
// 					startSakura();
// 				}
// 			}
// </script>
<script>
function clickEffect() {
let balls = [];
let longPressed = false;
let longPress;
let multiplier = 0;
let width, height;
let origin;
let normal;
let ctx;
const colours = ["#F73859", "#14FFEC", "#00E0FF", "#FF99FE", "#FAF15D"];
const canvas = document.createElement("canvas");
document.body.appendChild(canvas);
canvas.setAttribute("style", "width: 100%; height: 100%; top: 0; left: 0; z-index: 99999; position: fixed; pointer-events: none;");
const pointer = document.createElement("span");
pointer.classList.add("pointer");
document.body.appendChild(pointer);

if (canvas.getContext && window.addEventListener) {
  ctx = canvas.getContext("2d");
  updateSize();
  window.addEventListener('resize', updateSize, false);
  loop();
  window.addEventListener("mousedown", function(e) {
    pushBalls(randBetween(10, 20), e.clientX, e.clientY);
    document.body.classList.add("is-pressed");
    longPress = setTimeout(function(){
      document.body.classList.add("is-longpress");
      longPressed = true;
    }, 500);
  }, false);
  window.addEventListener("mouseup", function(e) {
    clearInterval(longPress);
    if (longPressed == true) {
      document.body.classList.remove("is-longpress");
      pushBalls(randBetween(50 + Math.ceil(multiplier), 100 + Math.ceil(multiplier)), e.clientX, e.clientY);
      longPressed = false;
    }
    document.body.classList.remove("is-pressed");
  }, false);
  window.addEventListener("mousemove", function(e) {
    let x = e.clientX;
    let y = e.clientY;
    pointer.style.top = y + "px";
    pointer.style.left = x + "px";
  }, false);
} else {
  console.log("canvas or addEventListener is unsupported!");
}


function updateSize() {
  canvas.width = window.innerWidth * 2;
  canvas.height = window.innerHeight * 2;
  canvas.style.width = window.innerWidth + 'px';
  canvas.style.height = window.innerHeight + 'px';
  ctx.scale(2, 2);
  width = (canvas.width = window.innerWidth);
  height = (canvas.height = window.innerHeight);
  origin = {
    x: width / 2,
    y: height / 2
  };
  normal = {
    x: width / 2,
    y: height / 2
  };
}
class Ball {
  constructor(x = origin.x, y = origin.y) {
    this.x = x;
    this.y = y;
    this.angle = Math.PI * 2 * Math.random();
    if (longPressed == true) {
      this.multiplier = randBetween(14 + multiplier, 15 + multiplier);
    } else {
      this.multiplier = randBetween(6, 12);
    }
    this.vx = (this.multiplier + Math.random() * 0.5) * Math.cos(this.angle);
    this.vy = (this.multiplier + Math.random() * 0.5) * Math.sin(this.angle);
    this.r = randBetween(8, 12) + 3 * Math.random();
    this.color = colours[Math.floor(Math.random() * colours.length)];
  }
  update() {
    this.x += this.vx - normal.x;
    this.y += this.vy - normal.y;
    normal.x = -2 / window.innerWidth * Math.sin(this.angle);
    normal.y = -2 / window.innerHeight * Math.cos(this.angle);
    this.r -= 0.3;
    this.vx *= 0.9;
    this.vy *= 0.9;
  }
}

function pushBalls(count = 1, x = origin.x, y = origin.y) {
  for (let i = 0; i < count; i++) {
    balls.push(new Ball(x, y));
  }
}

function randBetween(min, max) {
  return Math.floor(Math.random() * max) + min;
}

function loop() {
  ctx.fillStyle = "rgba(255, 255, 255, 0)";
  ctx.clearRect(0, 0, canvas.width, canvas.height);
  for (let i = 0; i < balls.length; i++) {
    let b = balls[i];
    if (b.r < 0) continue;
    ctx.fillStyle = b.color;
    ctx.beginPath();
    ctx.arc(b.x, b.y, b.r, 0, Math.PI * 2, false);
    ctx.fill();
    b.update();
  }
  if (longPressed == true) {
    multiplier += 0.2;
  } else if (!longPressed && multiplier >= 0) {
    multiplier -= 0.4;
  }
  removeBall();
  requestAnimationFrame(loop);
}

function removeBall() {
  for (let i = 0; i < balls.length; i++) {
    let b = balls[i];
    if (b.x + b.r < 0 || b.x - b.r > width || b.y + b.r < 0 || b.y - b.r > height || b.r < 0) {
      balls.splice(i, 1);
    }
  }
}
}
clickEffect();//调用特效函数
</script>
<script>
             //禁止鼠标右击
      document.oncontextmenu = function() {
        event.returnValue = false;
      };
      //禁用开发者工具F12
      document.onkeydown = document.onkeyup = document.onkeypress = function(event) {
        let e = event || window.event || arguments.callee.caller.arguments[0];
        if (e && e.keyCode == 123) {
          e.returnValue = false;
          return false;
        }
      };
      let userAgent = navigator.userAgent;
      if (userAgent.indexOf("Firefox") > -1) {
        let checkStatus;
        let devtools = /./;
        devtools.toString = function() {
          checkStatus = "on";
        };
        setInterval(function() {
          checkStatus = "off";
          console.log(devtools);
          console.log(checkStatus);
          console.clear();
          if (checkStatus === "on") {
            let target = "";
            try {
              window.open("about:blank", (target = "_self"));
            } catch (err) {
              let a = document.createElement("button");
              a.onclick = function() {
                window.open("about:blank", (target = "_self"));
              };
              a.click();
            }
          }
        }, 200);
      } else {
        //禁用控制台
        let ConsoleManager = {
          onOpen: function() {
            alert("Console is opened");
          },
          onClose: function() {
            alert("Console is closed");
          },
          init: function() {
            let self = this;
            let x = document.createElement("div");
            let isOpening = false,
              isOpened = false;
            Object.defineProperty(x, "id", {
              get: function() {
                if (!isOpening) {
                  self.onOpen();
                  isOpening = true;
                }
                isOpened = true;
                return true;
              }
            });
            setInterval(function() {
              isOpened = false;
              console.info(x);
              console.clear();
              if (!isOpened && isOpening) {
                self.onClose();
                isOpening = false;
              }
            }, 200);
          }
        };
        ConsoleManager.onOpen = function() {
          //打开控制台，跳转
          let target = "";
          try {
            window.open("about:blank", (target = "_self"));
          } catch (err) {
            let a = document.createElement("button");
            a.onclick = function() {
              window.open("about:blank", (target = "_self"));
            };
            a.click();
          }
        };
        ConsoleManager.onClose = function() {
          alert("Console is closed!!!!!");
        };
        ConsoleManager.init();
      }
        </script>